--[[ 编码: JX-29-11 名称: 盘点容器货品明细-3055 TOP-VIEW 容器输入变化 作者:HAN 日期:2025-1-29 级别:固定 (说明本段代码在项目中不太会变化) 函数: AfterCNTRChange 应用: -- 用在【盘点】功能的页面中的顶部输入界面,当输入界面中的容器编码输入框发生变化时触发 功能: -- 根据输入的容器号,判断在当前工作台是否有该容器号的 【盘点容器货品明细】 ,有显示在 当前任务 页签 -- 如果当前到站台的入库任务中的容器号和扫码输入的容器号不相等报错 更改记录: --]] json = require ("json") mobox = require ("OILua_JavelinExt") m3 = require("oi_base_mobox") function AfterCNTRChange ( strLuaDEID ) local nRet, strRetInfo -- 获取站台编码 nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_STATION_NO","S_CNTR_CODE" ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end local obj_attrs = json.decode( strRetInfo ) local station = lua.Get_StrAttrValue( obj_attrs[1].value ) local cntr_code = lua.Get_StrAttrValue( obj_attrs[2].value ) if ( station == '' or cntr_code == '' ) then return end -- 判断 容器 是否已经搬运到入库站台 -- CP_Count_Container 中的 N_B_STATE = 2 local strCondition = "S_STATION_NO = '"..station.."' AND N_B_STATE = 2 AND S_CNTR_CODE = '"..cntr_code.."'" nRet, strRetInfo = mobox.existThisData( strLuaDEID, "CP_Count_Container", strCondition ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end if ( strRetInfo ~= "yes" ) then mobox.setInfo( strLuaDEID, "盘点料箱'"..cntr_code.."'还没有到达站台"..station) return end strCondition = "S_STATION_NO = '"..station.."' AND N_B_STATE = 1 AND S_CNTR_CODE = '"..cntr_code.."'" local action = { { action_type = "set_query_condition", value = { condition = strCondition, order = "S_CELL_NO", page_name = "当前任务" } } } lua.Debug( strLuaDEID, debug.getinfo(1), "action", action ) nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo ) end end